package ru.spb.osll.myfit.client.event;

import ru.spb.osll.myfit.client.widget.PageElementWidget;
import ru.spb.osll.myfit.client.widget.PageWidget;

public class PageEvent {
  public enum PageEventType {
    DELETE_PAGE_ELEMENT, 
    ADD_TABLE, 
    ADD_INCLUDE, 
    ADD_WIKI
  }

  private final PageEventType m_type;
  private PageElementWidget m_source = null;
  private PageWidget m_parent = null;
  private boolean isBefore = false;

  public PageEvent(PageEventType type) {
    m_type = type;
    this.isBefore = false;
  }

  public PageEvent(PageEventType type, boolean isBefore) {
    m_type = type;
    this.isBefore = isBefore;
  }

  public PageEvent(PageEventType type, boolean isBefore, PageElementWidget source) {
    this(type, isBefore);
    m_source = source;
  }

  public PageEvent(PageEventType type, boolean isBefore, PageElementWidget source, PageWidget parent) {
    this(type, isBefore, source);
    m_parent = parent;
  }

  public PageEventType getType() {
    return m_type;
  }

  public PageElementWidget getSource() {
    return m_source;
  }

  public PageWidget getParent() {
    return m_parent;
  }

  public boolean isBefore() {
    return isBefore;
  }

}
